package com.malamute.system.entity;

import java.io.File;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.cafe.model.Placard;
import com.cafe.model.Product;
import com.malamute.core.entity.BaseEntity;

/**
 * 上传文件
 * 
 */
//@Entity
//@Table(name = "T_SYSTEM_FILE")
public class FileInSystem extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private String name;
	private String path;
	private String contentType;
	@Transient
	private File file;// 文件对象
	@ManyToOne(targetEntity = Product.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "outId")
	private Product product;
	
	@OneToOne(mappedBy = "fileInSystem", fetch = FetchType.EAGER, targetEntity = Placard.class)
	@JoinColumn(name = "outId")
	private Placard placard;// 海报

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public File getFile() {
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Placard getPlacard() {
		return placard;
	}

	public void setPlacard(Placard placard) {
		this.placard = placard;
	}

}
